#pragma once

namespace Lumin {
namespace Win32 {

enum WSA_IO_OPERATE 
{
	WSA_IO_UNKNOW,
	WSA_IO_ACCEPT,
	WSA_IO_RECV,
	WSA_IO_SEND,
	WSA_IO_DISCONNECT,
	WSA_IO_CONNECTED,
	WSA_IO_FAILED,
};

struct CIOContext
{
	WSAOVERLAPPED overlapped;
	WSABUF data;
	WSA_IO_OPERATE iop;
	IConnection* conn;
	ISerializeStream* stream;
	static void *operator new(size_t objSize);
	static void operator delete(void *pObj, size_t bufferSize);
	CIOContext(){
		data.buf = 0;
		data.len = 0;
		memset(&overlapped,0,sizeof(overlapped));
		iop = WSA_IO_UNKNOW;
		conn = NULL;
		stream = NULL;
	}
	~CIOContext()
	{
		if(stream != NULL){
			stream->Release();
		}
	}
};

}
}